var intervalId=0;
function findTr(){
	var str="";
	$("#nodeTableList > tbody > tr").each(function(){		
		var a=$(this).children("td");		//alert(str)
		str += $(a[1]).html()+","
	});
	queryInterval(str);
	//console.log(str)
	if(str==null || str==undefined||str=="")return;
	if(intervalId!=0)//清除已有的定时刷新
		clearInterval(intervalId)
	intervalId=setInterval(queryInterval,30000,str)//queryInterval(str)
}
function queryInterval(data){
	if(data==null || data==undefined ||data=="")return;
	console.log(data)
	$.ajax({
        type:"get",
        url:constUrl+"cmd/jhosts/runstat.action",
        dataType:"json",
        data: {
            nodes: data
           },
        success:function(data){
        	var trs=$("#nodeTableList > tbody > tr")
        	for(var i=0;i< trs.length;i++){
        		var tds =$(trs[i]).children("td");
        		var click=$(tds[6]).children().children().attr("onclick");
        		
        		//console.log(data[i])
        		$(tds[5]).children().html(nodeStatus(data[i].status));
        		var index0=click.indexOf("','");
        		var index1 =click.lastIndexOf(",");
        		if(index1>(index0+1)){
        			var des="";
        			des =click.substring(0,index0);
        			des += "','"+data[i].status +"'";
        			des += click.substring(index1,click.length)
        			var button=$(tds[6]).children().children()[0];
        			$(button).attr("onclick",des)
        			$(button).html((data[i].status=="ok")?"下线":"上线");
        		}
        		
        		//console.log("onclick: "+des);
        		//console.log($(tds[6]).children().children().attr("onclick"))
        		//console.log($(tds[6]).children().children().html())
        		//console.log(((data[i].status=="ok")?"下线":"上线"));
//        		$(tds[6]).html(data[i].hostData[2]);
//        		$(tds[4]).html(data[i].hostData[4]);
//        		$(tds[5]).html(data[i].hostStat[3]);
//        		$(tds[6]).html(data[i].hostStat[10]);
//        		$(tds[7]).html(data[i].hostStat[9]);
        	}
            //alert(data[0].hostData[2])
        },
        error:function () {
        }
        }
	);
}